# -*- coding: utf-8 -*-
''' 订单索引类
    可以使用metaclass创建共有类，但是考虑到后续可能的改变，
    还是直接copy代码吧
'''
from common import orm


class OrderIndex(orm.Model):
    '''订单索引类，API层面存在所有彩种按下单时间逆序/筛选的需求
    '''
    __tablename__ = "order_index"
    id = orm.Column(orm.BigInteger, primary_key=True, autoincrement=True)
    user_id = orm.Column(orm.BigInteger)
    activity_type = orm.Column(orm.SmallInteger)  # 彩种
    order_id = orm.Column(orm.BigInteger)  # 具体彩种的订单编号
    status = orm.Column(orm.BigInteger, default=1)  # 订单状态（供控制台查询）
    created_at = orm.Column(orm.DATETIME)  # 下单时间
    detail = orm.Column(orm.TEXT)


class TrackIndex(orm.Model):
    '''追号索引类
    '''
    __tablename__ = "track_index"
    id = orm.Column(orm.BigInteger, primary_key=True, autoincrement=True)
    user_id = orm.Column(orm.BigInteger)
    activity_type = orm.Column(orm.SmallInteger)  # 彩种
    track_id = orm.Column(orm.BigInteger)  # 追号ID
    status = orm.Column(orm.SmallInteger, default=1)  # 追号状态
    created_at = orm.Column(orm.DATETIME)
    detail = orm.Column(orm.TEXT)
